$OpenBSD: patch-cmd_docbook-to-man_sh,v 1.3 2013/12/02 18:20:00 zhuk Exp $
--- cmd/docbook-to-man.sh.orig	Mon Jun 17 05:50:30 1996
+++ cmd/docbook-to-man.sh	Sat Feb 12 00:07:52 2005
@@ -40,9 +40,12 @@
 # ***** change the following paths if your installation of nsgmls and / or
 # ***** DocBook isn't into the default places.
 
-ROOT=/usr/local
-SGMLS=$ROOT/lib/sgml
-DOCBOOK=$SGMLS/Davenport/dtd
+: ${ROOT=/usr/local}
+SGMLS=$ROOT/bin/nsgmls
+SGML=$ROOT/share/sgml/
+DOCBOOK=$SGML/docbook/4.1
+TMPFILE=`mktemp /tmp/dtm.psinc.XXXXXXXXXX || exit 1`
+trap 'rm -f $TMPFILE' 0 1 2 3 13 15
 
 
 # ***** modify the following line (to "=false") if you're not using the
@@ -58,10 +61,10 @@ doElanPSInclude=true
 #ulimit -c unlimited
 
 PARSER=nsgmls
-INSTANT=instant
+INSTANT=instant2
 INSTANT_OPT=-d
 
-CATALOG=$DOCBOOK/docbook.cat
+CATALOG=$SGML/catalog
 DECL=$DOCBOOK/docbook.dcl
 #PROLOG=$DOCBOOK/docbook.prolog
 
@@ -168,8 +171,13 @@ cat >> /tmp/dtm.$$.psinc <<\!
 #!
 #fi
 
-(cat /tmp/dtm.$$.psinc;
+(cat $TMPFILE;
  $PARSER -gl -m$CATALOG $DECL $INSTANCE |
-	$INSTANT $INSTANT_OPT -croff.cmap -sroff.sdata -tdocbook-to-man.ts)
+	$INSTANT $INSTANT_OPT -croff.cmap -sroff.sdata -tdocbook-to-man.ts|
+	sed 's/^[	 ]*//
+	     s/$/ /
+	     s/--/\\-\\-/g
+	     s/^-/\\-/
+	     s/\([^A-Za-z0-9\-]\)-/\1\\-/g' )
 
-rm -f /tmp/dtm.$$.psinc    
+rm -f $TMPFILE
